package info.yggdrasilroot.driverecorder;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;

import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceView;

/**
 * 
 * @author Masakazu Kobayashi
 * @version 1.0
 */
public class Main extends MapActivity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		final MapView mapView = (MapView)this.findViewById(R.id.viwMap);
		mapView.setEnabled(true);
		mapView.setClickable(true);
		mapView.setBuiltInZoomControls(true);
		final MyLocationOverlay mylocation = new MyLocationOverlay(getApplicationContext(), mapView);
		mylocation.onProviderEnabled(LocationManager.GPS_PROVIDER);
		mylocation.enableCompass();
		mylocation.enableMyLocation();
		mylocation.runOnFirstFix(new Runnable() {
			
			@Override
			public void run() {
				mapView.getController().animateTo(mylocation.getMyLocation());
			}
		});
		mapView.getOverlays().add(mylocation);
		mapView.invalidate();
		Log.d(getLocalClassName(), "map::invalidate()");
		final SurfaceView surfaceView = (SurfaceView)findViewById(R.id.viwPreview);
		new CameraPreview(this, surfaceView);
	}

	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}
}